package com.tongcao.cn;

import com.alibaba.nacos.spring.context.annotation.config.NacosPropertySource;
import com.alibaba.nacos.spring.context.annotation.config.NacosPropertySources;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.ImportResource;
import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author tongcao
 */
@SpringBootApplication(scanBasePackages = "com.tongcao.cn")
@EnableAspectJAutoProxy
@MapperScan("com.tongcao.cn.mapper")
@ImportResource({"classpath:beans/*.xml"})
@ServletComponentScan
@EnableSwagger2
@EnableScheduling
@NacosPropertySources({@NacosPropertySource(dataId = "example", autoRefreshed = true)})
public class BookerApplication extends SpringBootServletInitializer {


    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(BookerApplication.class);
//        app.setAdditionalProfiles("dev");
        app.run(args);
//        SpringApplication.run(BookerApplication.class, args);
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(BookerApplication.class);
    }
}
